<?php
namespace app\servermessage\validate;
use \app\manage\validate\BaseValidate;

class Message extends BaseValidate
{
    //发送站内信时的规则
	protected $rule =   [
        'id'=>['integer','gt'=>0],
        'user_id'=>['integer','gt'=>0],
        'from_uid'=>['integer','egt'=>0],
        'to_uid'=>['array','min'=>1,'different'=>'from_uid'],
        'title'=>['length'=>'2,50'],
        'content'=>['length'=>'5,500'],
        'type'=>['in'=>'0,1,2'],
        'msgType'=>['in'=>['receive','send']],
        'from_user_name' => ['min'=>2],
        'to_user_name' => ['min'=>2],
    ];

    protected $message  =   [
        'from_uid'=>'发件人不可为空',
        'to_uid.different'=>'收件人不能为自己',
        'title'=>'标题在2-50个字符之间',
        'content'=>'内容在5-500个字符之间',
        'type'=>'发件类型不正确 0系统，1用户，2应用',
    ];

    protected $scene = [
        'sendOne' => [
            'from_uid',
            'to_uid'=>['require','integer','egt'=>0,'different'=>'from_uid'],
            'title',
            'content',
            'type',
            'orther_info' => ['require'],
        ],
        'sendBatch' => [
            'from_uid',
            'to_uid'=>['array','min'=>1,'different'=>'from_uid'],
            'title',
            'content',
            'type',
            'orther_info' => ['require'],
        ],
        'checkOrtherInfo' => [
            'from_user_name' => ['require', 'min'=>2],
            'to_user_name' => ['require'],
        ],
        'checkId' => ['id'],
        'checkIds' => ['id'=>['array','min'=>1]],
        'checkIdUid' => ['id','user_id'],
        'checkIdsUid' => ['id'=>['array','min'=>1],'user_id'],
        'checkUid' => ['user_id'],
        'reply' => ['id','user_id','content','orther_info'=>['require']],
        'userMsgList' => ['user_id','msgType'],
        'adminMessageList' => ['user_id','page','listRows']
        
    ];

}